#ifndef _RS232_H_
#define _RS232_H_

#include "stm32f10x.h"

#define OK      0
#define ERROR   1

typedef enum
{
	NO_ERR,
	CRC_ERR,
	ESL_CRC_ERR,
	LOSE_PAKET_ERR,
	NO_ACK
}ACK_ERR;

void memsetRxBuf(void);
//void memset(unsigned char *buff,unsigned char tem ,unsigned int length);
//void memcpy(unsigned char *des,unsigned char *sour,unsigned int length);
unsigned char SetCRC(unsigned char *p) ;
void Uart1_init(unsigned int  Baud);
void USART1_IRQHandler(void);
void UsartSendStr(u8 *p,u32 length);
void SetRxCount(u32 tem);
u32 GetRxCount(void);
u8 GetRxbufState(void);
unsigned char  CheckCRC(void);
void SendToPC(ACK_ERR ucResult);

u8 CheckCMD(void);
void Send_ELS_ID_To_PC(void);

u8 CheckCRC_ESL(void);
void RF_Init(void);
void SendToESL(void);
u8 GetRF_RecieveState(void);
void SetRF_RecieveState(u8 tem);
void EXTI1_IRQHandler(void);

unsigned char CheckHubAdd(void);
void SendHubAdressToPC(void);
unsigned char CheckTypeCMD(void);
 void SendESLID(void);

#endif
